package com.example.weather.title

import android.util.SparseArray
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.library_base.base.BaseActivity
import com.example.library_base.router.WeatherRouterPath
import com.example.weather.BR
import com.example.weather.R
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

/**
 * 自定义标题
 * */
@AndroidEntryPoint
@Route(path = WeatherRouterPath.WEATHER_TITLE_CUSTOM)
class TitleCustomActivity: BaseActivity(R.layout.activity_title_custom) {

    @Inject
    lateinit var titleModel: TitleModel

    override fun getVariableSparseArray(): SparseArray<Any> {
        val variables = SparseArray<Any>()
        return variables
    }

    override fun initTitleBar() {
        super.initTitleBar(R.layout.layout_title)
        //自定义titleBar
        supportActionBar?.customView?.let {
            val binding = DataBindingUtil.bind<ViewDataBinding>(it)
            binding?.setVariable(BR.titleModel, titleModel)
            binding?.setVariable(BR.context, this)
            titleModel.title = "自定义标题"
        }
    }

    override fun initView() {

    }

    override fun requestData() {

    }
}